/*************************************************************************
	> File Name: telnetd.h
	> Author: xuwenlong
	> Mail: myxuan475@126.com 
	> Created Time: 2019年01月30日 星期三 17时01分10秒
 ************************************************************************/
#ifndef __REMOTED_H__
#define __REMOTED_H__

#include <utils/timer.h>
#include <queue>
#include <defines.h>
#include <transport/transport.h>

//#define TELNET_CUSTOM

class ProtocolHandler;

class Remoted:
        public TimerTask
{
public:
    Remoted();

    virtual ~Remoted();

    virtual void RunTimer();
    void TelnetDo();

    void Stop();

    DAS_RESULT Start(const Json::Value &params);

    bool IsTelneted();

    enum {TEL_INIT = 0,TEL_START,TEL_RUN,TEL_END};
private:
    int connect_server(const std::string &host,int port);
private:
    Timer *m_ackTimer;
    Lock  m_flaglock;
    U8  m_eFlag;

    std::string m_type;
    std::string m_hostname;
    int m_iPort;
#ifdef TELNET_CUSTOM
    int m_iSock;
#endif
};

#endif
